﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>
<%@ Import namespace="VnResource.DataContract.Models" %>

<div class="WebHRMain" style="width: 90%;">
    <div id="divContainerMain">
        <div align="center" class="WebHR_Heading1">
            <%=Html.Label("Ngày Nghỉ") %>
        </div>
        <div style="clear: both;">
        </div>
        <form id="formLogin" method="post" action="/HRM/EditingPopup_Create">
            <%=Html.Hidden("ID") %>

        <!-- Nhóm Thông tin cơ bản -->
        <fieldset style="float: left;">
            <legend>
                <%=Html.Label("Thông tin cơ bản")%>
            </legend>
            <!-- noi dung -->
                   <div id="Div1">
                <div class="FieldTitle">
                    <%=Html.Label("Nhân viên")%>
                </div>
                <div class="FieldValue" style="width:300px;">
                    <%= Html.Kendo().MultiSelect()
          .Name(LeaveDayViewModel.FieldNames.ProfileID)
          .DataTextField(UIConstants.Text)
          .DataValueField(UIConstants.Value)
          .Placeholder("Select employee...")
          .BindTo((List<SelectListItem>) Session[SessionObjects.Profile] )
          
            %>
                </div>
                <div style="clear: both;">
                </div>
            </div>


            <div id="dvleaveDayType">
                <div class="FieldTitle">
                    <%=Html.Label("Loại ngày nghỉ")%>
                </div>
                <div class="FieldValue">
                    <%= Html.Kendo().ComboBox()
                                  .Name("LeaveDayType")
          .Filter("contains")
          .Placeholder("Chọn loại ngày nghỉ...")
          .DataTextField("Text")
          .DataValueField("Value")
          .BindTo(new List<SelectListItem>() {
              new SelectListItem() {
                Text = "Phép nghỉ ốm", Value = "LEAVEDAY1"   
              },
              new SelectListItem() {
                Text = "Không phép", Value = "LEAVEDAY2"   
              },
              new SelectListItem() {
                Text = "Nghỉ đi công tác", Value = "LEAVEDAY3"   
              },
              new SelectListItem() {
                Text = "Phép năm", Value = "LEAVEDAY4"   
              }
          })
        
          .Suggest(true)
                    %>
                </div>
                <div style="clear: both;">
                </div>
            </div>
            <div id="dvDateFrom">
                <div class="FieldTitle">
                    <%=Html.Label("Ngày bắt đầu")%>
                </div>
                <div class="FieldValue">
                    <%= Html.Kendo().DatePicker()
                     .Name("DateStart")                    
                     
                      .Value(DateTime.Today)  
                      .HtmlAttributes(new { style = "width:150px" })
                    %>
                </div>
                <div style="clear: both;">
                </div>
            </div>
            <div id="dvDateTo">
                <div class="FieldTitle">
                    <%=Html.Label("Ngày kết thúc")%>
                </div>
                <div class="FieldValue">
                    <%= Html.Kendo().DatePicker()
                    .Name("DateEnd")                     
                    
                      .Value(DateTime.Today)  
                      .HtmlAttributes(new { style = "width:150px" })
                    %>
                </div>
                <div style="clear: both;">
                </div>
            </div>
             
            <div id="dvApproveFirst">
                <div class="FieldTitle" >
                    <%=Html.Label("Người duyệt đầu")%>
                </div>
                <div class="FieldValue" style="width:300px;">
                    <%= Html.Kendo().ComboBox()                    
          .Name("UserApproveID")
          .Filter("contains")
          .Placeholder("Chọn người duyệt đầu...")
          .DataTextField("Text")          
          .DataValueField("Value")
          .BindTo((List<SelectListItem>)Session[UIConstants.ApproveProfile])
          .SelectedIndex(3)                    
          .Suggest(true)
                    %>
                </div>
                <div style="clear: both;">
                </div>
            </div>

            <div id="dvApproveLast">
                <div class="FieldTitle">
                    <%=Html.Label("Người duyệt cuối")%>
                </div>
                <div class="FieldValue" style="width:300px;">
                    <%= Html.Kendo().ComboBox()
          .Name("UserApproveID2")
          .Filter("contains")
          .Placeholder("Chọn người duyệt cuối...")
          .DataTextField("Text")
          .DataValueField("Value")
                                  .BindTo((List<SelectListItem>)Session[UIConstants.ApproveProfile])
          .SelectedIndex(3)
          .Suggest(true)
                    %>
                </div>
                <div style="clear: both;">
                </div>
            </div>

            <div id="dvSave">
                <div class="FieldTitle">
                </div>
                <div class="FieldValue">
                    <input type="submit" value="Lưu" />
                    <%--<input type="button" value="test" onclick="testClick();" />--%>
                </div>
                <div style="clear: both;">
                </div>
            </div>
        </fieldset>
        </form>
    </div>
</div>


<script type="text/javascript">
    function testClick() {
        Ajax.submitAjax("HRM", "EditingPopup_Create", "formLogin", function (data) {
            VnrUtils.log(data);          
            var grid = $("#gridLeaveDay").data("kendoGrid");
            grid.refresh();
                    
        });
    }
</script>